<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.hzqy.commons.utils.ConstantUtils" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>子订单展示页面</title>
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/defalut.css">
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/public.css">
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/ddspstyle.css">
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css"	href="../../static/js/themes/icon.css">
    <script type="text/javascript" src="../../static/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../static/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../../static/js/detailview/datagrid-detailview.js"></script>
    <script type="text/javascript" src="../../static/js/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../../static/js/index.js"></script>
    <%
        String f_sd_oid=request.getParameter("f_sd_oid");
        String f_sd_buyTime=request.getParameter("f_sd_buyTime");
        String pageNo=request.getParameter("pageNo");
        String f_sd_uid=request.getParameter("f_sd_uid");
        String f_sd_village=request.getParameter("f_sd_village");
        String f_sd_orderid=request.getParameter("f_sd_orderid");
        if(pageNo==null){
            pageNo="1";
        }
//        String img_url= getServletContext().getInitParameter("img_url");
        String []nonceObj=ConstantUtils.getNonceObject();
    %>
    
    <script type="text/javascript">
        function EasyuiDatagrid() {
            var f_sd_oid= '<%=f_sd_oid%>';
            $("#easyui-datagrid").datagrid({
                url: '../../industry/DICT/selectOrderByPoid.do?f_sd_oid='+f_sd_oid,
                nowrap: true,
                striped: true,
                border: false,
                fit: true,
                rownumbers:true,
                columns: [[
                    {field:'f_sd_code',checkbox:true},
                    {field:'f_sd_oid',title:'订单编号',align:'center',width:100},
                    {field:'f_sd_orderid',title:'订单号',align:'center',width:100},
                    {field:'f_sd_good_sys',title:'商品所属系统',align:'center',width:150},
                    {field:'f_sd_good_brand',title:'商品品牌',align:'center',width:150},
                    {field:'f_sd_good',title:'购买的商品',align:'center',width:150},
                    {field:'f_sd_money',title:'商品单价',align:'center',width:150},
                    {field:'f_sd_buyTime',title:'下单时间',align:'center',width:150},
                    {field:'f_sd_type',title:'操作',align:'center',width:350,
                        formatter:function(value,row,index){
                            str ="";
                            str= '<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="onClickBtnDelete(\''+row.f_sd_poid+'\',\''+row.f_sd_isTotal+'\',\''+row.f_sd_buyTime+'\',\''+row.f_sd_money+'\',\''+row.f_sd_oid+'\');" ><span class="l-btn-left"><span class="l-btn-text icon-remove l-btn-icon-left">删除子订单</span></span></a>';
                            str+= '<a class="easyui-linkbutton l-btn l-btn-plain" iconCls="icon-ok" href="javascript:void(0);" plain="true" onclick="updateUser(\''+row.f_sd_oid+'\',\''+row.f_sd_uid+'\',\''+row.f_sd_village+'\',\''+row.f_sd_poid+'\');" ><span class="l-btn-left"><span class="l-btn-text icon-edit l-btn-icon-left">修改订单信息</span></span></a>';
                            return str;
                        }
                    }
                ]],
                singleSelect:false,
                pagination:true,
                pageList:[10,20,30,40,50],
                pageSize:10,
                toolbar: '#toolbar',
                
                onExpandRow: function(index,row){
                
                },
                onSelect: function(rowIndex,rowData) {
                
                },
                onUnselect: function(rowIndex,rowData) {
                
                },
                onCheckAll: function(rowIndex,rowData) {
                
                },
                onUncheckAll: function(rowIndex,rowData) {
                
                },
                onLoadSuccess: function(data) {
                    if(data.total==-1) {
                        $.messager.defaults={ok:"确定",cancel:"取消"};
                        $.messager.confirm('提示', '用户尚未登录,请登录', function(r){
                            if (r){
                                window.parent.location.href='/login.do';
                                return false;
                            }});
                    }
                }
            });
        }
        
        $(function(){
            new EasyuiDatagrid();
            onClickBtnDelete = function(pid,tid,time,money,id){
                $.messager.confirm('确定删除内容','确定删除内容么?',function(r){
                    if(r){
                        app_ajax('../../industry/DICT/deleteOrder.do?f_sd_poid='+pid+'&f_sd_isTotal='+tid+"&f_sd_buyTime="+time+"&f_sd_money="+money+"&f_sd_oid="+id,
                            '',
                            function(msg){
                                if(msg.success) {
                                    alert("删除成功!");
                                    if (checkAjaxRequestValidity(msg)) {
                                        gotoSearch($('#easyui-treegrid'));
                                        window.location.reload();
                                    }
                                } else {
                                    alert("删除异常，请联系管理员");
                                    if($.isFunction(window.showMessager)){
                                        window.showMessager(msg.resultTitle,msg.result);
                                    }
                                }
                            }
                        );
                    }
                });
            };
        });
        
        function SubgridTabOnSelect(title,index){
            setTimeout(function(){
                $("#easyui-datagrid").datagrid('fixDetailRowHeight',index);
            },300);
            setTimeout(function(){
                $("#easyui-datagrid").datagrid('fixDetailRowHeight',index);
            },3000);
        }
        
        function load(){
            $(".datagrid-row-expander datagrid-row-expand").attr("display","none");
        }
        
        function onpress(){
            var event=arguments.callee.caller.arguments[0]||window.event;//消除浏览器差异
            if (event.keyCode == 13){
                gotoSearch($('#easyui-treegrid'));
            }
        }
        
        function updateUser(id,uid,village,pid){
            openDialog($('#dlgu'),'update_order.jsp?f_sd_oid='+id+"&f_sd_uid="+uid+"&f_sd_village="+village+"&f_sd_poid="+pid);
        }
        function add(){
            var f_sd_oid= '<%=f_sd_oid%>';
            var uid= '<%=f_sd_uid%>';
            var village= '<%=f_sd_village%>';
            var time= '<%=f_sd_buyTime%>';
            var f_sd_orderid= '<%=f_sd_orderid%>';
            openDialog($('#dlga'),'insert_order.jsp?f_sd_uid='+uid+"&f_sd_village="+village+"&f_sd_poid="+f_sd_oid+"&f_sd_buyTime="+time+"&f_sd_orderid="+f_sd_orderid);
        }

    </script>
</head>
<body onload="load();">
<table id="easyui-datagrid" title="子订单详情列表"></table>

<div id="toolbar" class="easyui_datagrid_toolbar" style="">
    <div>
        <a href="javascript:void(0);" class="easyui-linkbutton"	data-options="iconCls:'icon-add', plain:true" onclick="add()">添加子订单</a>
    </div>

</div>

<div id="dlgu" class="easyui-dialog"	style="width: 700px; height: 500px; padding-top: 0px;"
     data-options="title:'修改订单信息', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
    <iframe scrolling="auto" frameborder="0" style="width: 100%; height: 99%;"></iframe>
</div>
<div id="dlga" class="easyui-dialog"	style="width: 700px; height: 500px; padding-top: 0px;"
     data-options="title:'添加订单信息', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
    <iframe scrolling="auto" frameborder="0" style="width: 100%; height: 99%;"></iframe>
</div>

</head>

</body>
</html>

